﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebVideo.Areas.Admin.Models;

namespace WebVideo.Areas.Admin.Controllers
{
    public class ThongBaoController : Controller
    {
        //
        // GET: /Admin/ThongBao/
        public ActionResult ThanhCong()
        {
            return View();
        }
        public ActionResult Edit()
        {
            return View(ThongBaoModel.LayModel(1));
        }

        [ValidateInput(false)]
        [HttpPost]
        public ActionResult Edit(ThongBaoModel FAQ)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ThongBaoModel.Edit(FAQ,1);
                    return RedirectToAction("ThanhCong", "ThongBao");
                }
            }
            catch
            {

                return RedirectToAction("Index", "Error", new { errorMsg = "Lỗi SQL hosting / server" });
            }
            return View(FAQ);
        }
        // edit bản hợp đồng
        public ActionResult Edit1()
        {
            return View(ThongBaoModel.LayModel(2));
        }

        [ValidateInput(false)]
        [HttpPost]
        public ActionResult Edit1(ThongBaoModel FAQ)
        {

            try
            {
                if (ModelState.IsValid)
                {
                    ThongBaoModel.Edit(FAQ,2);
                    return RedirectToAction("ThanhCong", "ThongBao");
                }
            }
            catch
            {

                return RedirectToAction("Index", "Error", new { errorMsg = "Lỗi SQL hosting / server" });
            }
            return View(FAQ);
        }
    }
}
